package com.wrial.mall.search.controller;
/*
 * @Author  Wrial
 * @Date Created in 21:31 2020/5/26
 * @Description
 */

import com.wrial.mall.search.service.MallSearchService;
import com.wrial.mall.search.vo.SearchParam;
import com.wrial.mall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {

    @Autowired
    MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String listPage(SearchParam searchParam, Model model){
        SearchResult search = mallSearchService.search(searchParam);
        model.addAttribute("result", search); 
        return "list";
    }
}
